<?php

namespace Beerus\Modules\Extend\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Hhz\AdministrativeRegion\Region;

/**
 * 根据省市区获取市区列表
 */
class AreaController extends Controller
{
    public function get(Request $request, $pid = 0)
    {
        $code = "";
        $q = $request->get('q', null);
        if (!is_null($q)) {
            $code = (string) $q;
        }
        $areas = Region::getCityListByProvinceCode($code, true);
        return response()->json($areas);
    }
}
